import { Component, OnInit, Input, EventEmitter, Output } from '@angular/core';

@Component({
  selector: 'app-change',
  templateUrl: './change.component.html',
})
export class ChangeComponent implements OnInit {
  @Input() changeId: string
  @Input() title: string
  @Output() changeListener = new EventEmitter<string>();

  constructor() { }

  ngOnInit() {
  }

  public show() {
    const ele: any = $(`#${this.changeId}`)
    ele.modal('show', {backdrop: 'static'})
  }

  public hide() {
    const ele: any = $(`#${this.changeId}`)
    ele.modal('hide')
  }

  private onClickOk(event: any) {
    this.hide()
    this.changeListener.emit('ok')
  }

  private onClickCancel(event: any) {
    this.hide()
    this.changeListener.emit('cancel')
  }

}
